package com.tyl.xtk.beans.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

/**
 * create by tyl at 2025/8/27
 */
@Setter
@Getter
@AllArgsConstructor
public class Result<T> {

    private int code;
    private String message;
    private T data;


    public static <T> Result<T> success(T data) {
        return new Result<>(200, "success", data);
    }

    public static <T> Result<T> fail(String message) {
        return new Result<>(500, message, null);
    }

    public static <T> Result<T> fail(String message, T data) {
        return new Result<>(500, message, data);
    }

    public static <T> Result<T> fail(int code, String message, T data) {
        return new Result<>(code, message, data);
    }
}
